﻿using AllInOne.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AllInOne.Classes
{
    internal class SystemParam
    {
        /// <summary>
        /// 接口地址
        /// </summary>
        public static string ApiUrl = INIHelper.Read("ALL", nameof(ApiUrl), "http://172.59.23.250:9029/api/");
        /// <summary>
        /// 主窗体标题
        /// </summary>
        public static string MainTitle = INIHelper.Read("ALL", nameof(MainTitle), "");
        
        /// <summary>
        /// 信息倒计时 秒
        /// </summary>
        public static int CountDownInfo = AppSetting.GetValue<int>("CountDownInfo", 10);
        /// <summary>
        /// 打印倒计时 秒
        /// </summary>
        public static int CountDownPrint = AppSetting.GetValue<int>("CountDownPrint", 30);
        /// <summary>
        /// 确认信息倒计时 秒
        /// </summary>
        public static int CountDownConfirm = AppSetting.GetValue<int>("CountDownConfirm", 30);
        /// <summary>
        /// 授权信息倒计时 秒
        /// </summary>
        public static int CountDownAuth = AppSetting.GetValue<int>("CountDownAuth", 60);

        /// <summary>
        /// 打印类型，0：正常打印，1：横向打印
        /// </summary>
        public static int PrintType = AppSetting.GetValue<int>("PrintType", 0);



        #region 本软件所需配置参数据

        /// <summary>
        /// 发卡模式，1表示自助机发卡 2表示手动发卡
        /// </summary>
        public static int SendCardModel = INIHelper.Read("ALL", nameof(SendCardModel), 1);

        /// <summary>
        /// 显示测试页面标志
        /// </summary>
        public static int TestPage = INIHelper.Read("ALL", nameof(TestPage), 0);

        /// <summary>
        /// 发卡机串口号 ,默认COM1
        /// </summary>
        public static string SendSerialPortName = INIHelper.Read("ALL", nameof(SendSerialPortName), "COM1");
        
        /// <summary>
        /// 发卡机串口波特率 ,默认9600
        /// </summary>
        public static int SendBaudRate = INIHelper.Read("ALL", nameof(SendBaudRate), 9600);

        /// <summary>
        /// 测试发卡机--主界面初始化发卡机
        /// </summary>
        public static int TestSendCard = INIHelper.Read("ALL", nameof(TestSendCard), 0);

        

        /// <summary>
        /// 读取IC卡信息倒计时 秒
        /// </summary>
        public static int CountDownReadCard = AppSetting.GetValue<int>("CountDownReadCard", 60);

        /// <summary>
        /// 二维码扫描信息倒计时 秒
        /// </summary>
        public static int CountDownReadQR_Code = AppSetting.GetValue<int>("CountDownReadQR_Code", 60);

        /// <summary>
        /// 打印出门证是否隐去身份证生日四位
        /// </summary>
        public static bool HiddenBirthdy = INIHelper.Read("ALL", nameof(HiddenBirthdy), false);

        /// <summary>
        /// 是否启用入厂货物制卡时发货单位精简显示
        /// </summary>
        public static bool ShowSelect = INIHelper.Read("ALL", nameof(ShowSelect), false);
        
        /// <summary>
        /// SenderList表inputcode字段值判断
        /// </summary>
        public static string InputCode = INIHelper.Read("ALL", nameof(InputCode), "1");
        
        #endregion

        #region 手动发卡软件所需配置参数据

        /// <summary>
        /// 读卡器串口名 ,默认COM1
        /// </summary>
        public static string ICCardSerialPortName = INIHelper.Read("ALL", nameof(ICCardSerialPortName), "COM1");

        /// <summary>
        /// 读卡器波特率 ,默认9600
        /// </summary>
        public static int ICCardBaudRate = INIHelper.Read("ALL", nameof(ICCardBaudRate), 9600);
        #endregion

        #region 数据展示部分配置
        /// <summary>
        /// 是否测试模式
        /// </summary>
        public static bool ShowTest = INIHelper.Read("ALL", nameof(ShowTest), false);

        /// <summary>
        /// 是否隐藏厂内流转货物制卡
        /// </summary>
        public static bool HideInnerButtonPage = INIHelper.Read("ALL", nameof(HideInnerButtonPage), false);

        /// <summary>
        /// 是否隐藏阴极铜制卡
        /// </summary>
        public static bool HideYJTButtonPage = INIHelper.Read("ALL", nameof(HideYJTButtonPage), false);

        #endregion

    }

    internal class LoginInfo
    {
        /// <summary>
        /// 当前用户
        /// </summary>
        public static string UserName { get; set; }
        /// <summary>
        /// 当前用户角色
        /// </summary>
        public static int UserPower { get; set; }
        /// <summary>
        /// 验证用户
        /// </summary>
        public static string VerifyUserName { get; set; }
        /// <summary>
        /// 验证角色
        /// </summary>
        public static int VerifyUserPower { get; set; }
    }
}
